﻿Imports Microsoft.TeamFoundation.Migration.Toolkit
Imports Microsoft.TeamFoundation.Migration.Toolkit.Wit
Imports System.IO
Imports System.Xml.Serialization

Public Class HeatItsmWorkItemTrackingProviderFactory
    Implements IConfigFactory

#Region " IConfigFactory "

    ''' <summary>
    ''' Creates an instance of the Wss work item tracking end point (provider).
    ''' </summary>
    ''' <param name="type">Type expected</param>
    ''' <param name="xmlFragment">Xml containing provider specific settings</param>
    ''' <returns>Instance of the custom end point.</returns>
    Public Function CreateInstance(ByVal type As System.Type, ByVal xmlFragment As String) As Object Implements Microsoft.TeamFoundation.Migration.Toolkit.IConfigFactory.CreateInstance
        If type Is GetType(IWorkItemTrackingEndpoint) Then
            Using sr As StringReader = New StringReader(xmlFragment)
                Dim xs As XmlSerializer = New XmlSerializer(GetType(HeatItsmMigrationWorkItemStore))
                Return xs.Deserialize(sr)
            End Using
        End If
        Return Nothing
    End Function

#End Region



End Class
